<template>
	<view class="container">
		<!-- 打卡审核 -->
		<template v-if="dataList.length>0">
			<block v-for="(item,index) in dataList" :key="index">
				<view @click="projectToPage(item._id)" class="container-bg z-font-lg u-padding-40 z-b-r u-flex u-row-between u-margin-bottom-20" hover-class="h-class">
					<view class="u-flex u-flex-1">
						<view class="u-margin-right-10"><u-icon name="order"></u-icon></view>
						<view>{{item.project_name}}</view>
					</view>
					<view class="u-margin-right-10"><u-icon name="arrow-right"></u-icon></view>
				</view>
			</block>
		</template>
		<template v-else>
			<empty-data tipText="去创建一个项目吧!"></empty-data>
		</template>
	</view>
</template>

<script>
	import {mapState} from "vuex";
	export default {
		data() {
			return {
				dataList:[]
			}
		},
		computed:{
			...mapState({
				token:"token",
				userID:"userID"
			})
		},
		onLoad() {
			this.getUnderwayProject()
		},
		methods: {
			async getUnderwayProject(){
				let {token,userID} = this;
				this.$loading("正在加载")
				let res = await this.$network({
					api:"main",
					data:{
						action:"projectAdmin/getProjectInfo",
						data:{
							token,
							userID,
							statusID:2
						}
					}
				})
				uni.hideLoading()
				if(res.status === 0){
					this.dataList = res.data;
				}
			},
			async projectToPage(id){
				uni.navigateTo({
					url:`./sign-admin/sign-admin?projectID=${id}`
				})
			}
		}
	}
</script>
